#include "bsp_seg.h"

#include "stm32f10x.h"

const uint8_t  pnDigitalFontTable[16]=
{
	0x6f,
	0x05,
	0x76,
	0x57,
	0x1d,
	0x5b,
	0x79,
	0x07,
	0x7f,
	0x5f,
	0x3f,
	0x79,
	0x6a,
	0x75,
	0x7a,
	0x3a
};
void H595_GPIO_Config(void)
{
	GPIO_InitTypeDef GPIO_InitStructure;
	RCC_APB2PeriphClockCmd( H595_gpio_CLK, ENABLE);
	GPIO_InitStructure.GPIO_Pin = (H595_sdat_PIN|H595_stcp_PIN	|H595_shcp_PIN);
	GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
	GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
	GPIO_Init(H595_gpio_PORT, &GPIO_InitStructure);
	GPIO_ResetBits( H595_gpio_PORT,H595_sdat_PIN|H595_stcp_PIN	|H595_shcp_PIN );
}

void SendTo_595(uint8_t sdat)
 {
		
		uint8_t i=0,index=0x80;
		sdat=pnDigitalFontTable[sdat];
	 
	 for(i=0;i<8;i++)
	 {
		 
		 if((sdat&index)==0)
		 {
			 H595_sdat_l;
		 }
		 else
		 {
			 H595_sdat_h;
		 }
		
		 
		 H595_shcp_l;
		 H595_shcp_h;
		 index=(index>>1);
		 
	 }
	 H595_stcp_l;
	 H595_stcp_h;
 }	 
 